package com.canbot.u05.utils;

import android.util.Base64;

/**
 * Base64编码和解码
 * Created by LiuTao008
 * on 2016/1/22.
 */
public class Base64Utils {
    /**
     * Base64编码
     * @param strSrc 需要编码的字符串
     * @return 编码后的字符串
     */
    public static String encrypt(String strSrc){
        String strBse64 ="";
 
        byte[] bytes = Base64.encode(strSrc.getBytes(), Base64.DEFAULT);
        strBse64 = new String(bytes);
        return strBse64;
    }
 
    /**
     * Base64解码
     * @param strBase64 需要解码的base64串
     * @return 解码后的串
     */
    public static String decrypt(String strBase64){
        String strDes = "";
        byte[] bytes = Base64.decode(strBase64.getBytes(), Base64.DEFAULT);
        strDes = new String(bytes);
        return strDes;
    }
}